import { Component, OnInit } from '@angular/core'
import { Router } from '@angular/router'
import { FormBuilder, FormGroup, Validators } from '@angular/forms'

@Component({
  selector: 'app-login',
  templateUrl: './login.component.html',
  styleUrls: ['./login.component.scss']
})
export class LoginComponent implements OnInit {
  validateForm!: FormGroup
  mlmlh = false

  constructor(public router: Router, private fb: FormBuilder) {
    this.mlmlh = true
  }

  submitForm(): void {
    // for (const i of Object.keys(this.validateForm.controls)) {
    //   this.validateForm.controls[i].markAsDirty()
    //   this.validateForm.controls[i].updateValueAndValidity()
    // }
    this.router.navigateByUrl('/dashboard')
  }

  ngOnInit(): void {
    this.validateForm = this.fb.group({
      userName: [null, [Validators.required]],
      password: [null, [Validators.required]],
    })
  }

  login(): void {
    // this.router.navigateByUrl('/dashboard')
  }

  logout(): void {
  }
}
